package io.command;

import io.IIO;
import io.command.result.IOResult;
import io.command.result.IOCharResult;

/**
 * Command for show message if the game will be play again
 * 
 * 
 * @version 1.0.2
 */
public class ContinueGameCommand extends IOCommand {

	private String winner;

	public ContinueGameCommand(IIO io, String winner) {
		super(io);
		this.winner = winner;
	}

	/**
	 * Command details
	 */
	@Override
	public IOResult execute() {

		char choice;

		do {
			io.println("Winner is player " + winner + ". Continue? (y/n)");
			choice = io.getNextInput().charAt(0);
		} while (choice != 'y' && choice != 'n');

		return new IOCharResult(choice);
	}

}
